<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII" />
<title>
  File: README
  
    &mdash; Documentation by YARD 0.8.7.6
  
</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '';
  framesUrl = "frames.html#!file.README.html";
</script>


  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="_index.html">Index</a> &raquo; 
    <span class="title">File: README</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><div id='filecontents'><h1>ReadyPool</h1>

<h2>Ruby Thread Pool Implementation</h2>

<h3>Example</h3>

<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ready_pool</span><span class='tstring_end'>'</span></span>
<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>async_emitter</span><span class='tstring_end'>'</span></span>

<span class='id identifier rubyid_emitter'>emitter</span> <span class='op'>=</span> <span class='const'>AsyncEmitter</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>

<span class='id identifier rubyid_emitter'>emitter</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span> <span class='symbol'>:data</span><span class='comma'>,</span> <span class='id identifier rubyid_lambda'>lambda</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_data'>data</span><span class='op'>|</span> <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>emitted </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_data'>data</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span>

<span class='id identifier rubyid_rp'>rp</span> <span class='op'>=</span> <span class='const'>ReadyPool</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='int'>10</span><span class='comma'>,</span> <span class='const'>Proc</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_data'>data</span><span class='op'>|</span> <span class='id identifier rubyid_emitter'>emitter</span><span class='period'>.</span><span class='id identifier rubyid_emit'>emit</span> <span class='symbol'>:data</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span> <span class='rbrace'>}</span>

<span class='int'>20</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
    <span class='id identifier rubyid_rp'>rp</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span> <span class='id identifier rubyid_i'>i</span>
<span class='kw'>end</span>

<span class='id identifier rubyid_gets'>gets</span> <span class='comment'>#waits for keypress 
</span>
<span class='id identifier rubyid_rp'>rp</span><span class='period'>.</span><span class='id identifier rubyid_kill_all'>kill_all</span>

</code></pre>
</div></div>

    <div id="footer">
  Generated on Fri May  1 09:30:42 2015 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.7.6 (ruby-1.9.3).
</div>

  </body>
</html>